package zzj.campus_book_sharing_platform.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import zzj.campus_book_sharing_platform.Service.EbookShelfService;
import zzj.campus_book_sharing_platform.uitl.ResultFormat;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * (EbookShelf)表控制层
 *
 * @author ZZJ
 * @since 2022-03-01 22:00:17
 */
@Tag(name = "书架分类服务")
@RestController
@RequestMapping("/ebookShelf")
public class EbookShelfController {
    /**
     * 服务对象
     */
    @Resource
    private EbookShelfService service;

    /**
     * 书架-取消收藏
     *
     * @param ebookName   电子书名称
     * @return 对象列表
     */
    @Operation(summary = "书架-取消收藏")
    @RequestMapping(value = "cancelCollection",method = RequestMethod.GET)
    public ResultFormat ebookShelfCancelCollection(String ebookName, HttpSession session){
        return service.ebookShelfCancelCollection(ebookName, session);
    }

    /**
     * 书架-分页查询
     *
     * @param ebookName   电子书名称
     * @param ebookCategory   电子书分类
     * @return 对象列表
     */
    @Operation(summary = "书架-分页查询")
    @RequestMapping(value = "quarryAll",method = RequestMethod.GET)
    public ResultFormat ebookShelfQuarryAll(String ebookName,String ebookCategory, HttpSession session){
        return service.ebookShelfQuarryAll(ebookName,ebookCategory, session);
    }

    /**
     * 读取电子书
     *
     * @param ebookName   电子书名称
     * @param ebookRead   进度
     * @param readState   状态（审核/阅读）
     * @return 对象列表
     */
    @Operation(summary = "书架-读取电子书")
    @RequestMapping(value = "read",method = RequestMethod.GET)
    public ResultFormat ebookShelfRead(Integer ebookRead,String ebookName,String readState,HttpSession session){
        return service.ebookShelfRead(ebookRead, ebookName, readState, session);
    }

}

